<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/doctrine/BaseFormFilterDoctrine.class.php');

/**
 * ArticleArticle filter form base class.
 *
 * @package    filters
 * @subpackage ArticleArticle *
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 11675 2008-09-19 15:21:38Z fabien $
 */
class BaseArticleArticleFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'article_author_id'   => new sfWidgetFormFilterInput(),
      'article_category_id' => new sfWidgetFormFilterInput(),
      'title'               => new sfWidgetFormFilterInput(),
      'summary'             => new sfWidgetFormFilterInput(),
      'body'                => new sfWidgetFormFilterInput(),
      'reference'           => new sfWidgetFormFilterInput(),
      'view'                => new sfWidgetFormFilterInput(),
      'download'            => new sfWidgetFormFilterInput(),
      'wordcount'           => new sfWidgetFormFilterInput(),
      'is_public'           => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'is_activated'        => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'is_featured'         => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'activated_at'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'expires_at'          => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'slug'                => new sfWidgetFormFilterInput(),
      'created_at'          => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'updated_at'          => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
    ));

    $this->setValidators(array(
      'article_author_id'   => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'article_category_id' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'title'               => new sfValidatorPass(array('required' => false)),
      'summary'             => new sfValidatorPass(array('required' => false)),
      'body'                => new sfValidatorPass(array('required' => false)),
      'reference'           => new sfValidatorPass(array('required' => false)),
      'view'                => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'download'            => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'wordcount'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'is_public'           => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'is_activated'        => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'is_featured'         => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'activated_at'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'expires_at'          => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'slug'                => new sfValidatorPass(array('required' => false)),
      'created_at'          => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'updated_at'          => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
    ));

    $this->widgetSchema->setNameFormat('article_article_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'ArticleArticle';
  }

  public function getFields()
  {
    return array(
      'id'                  => 'Number',
      'article_author_id'   => 'Number',
      'article_category_id' => 'Number',
      'title'               => 'Text',
      'summary'             => 'Text',
      'body'                => 'Text',
      'reference'           => 'Text',
      'view'                => 'Number',
      'download'            => 'Number',
      'wordcount'           => 'Number',
      'is_public'           => 'Boolean',
      'is_activated'        => 'Boolean',
      'is_featured'         => 'Boolean',
      'activated_at'        => 'Date',
      'expires_at'          => 'Date',
      'slug'                => 'Text',
      'created_at'          => 'Date',
      'updated_at'          => 'Date',
    );
  }
}